#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);


    //treeWidget树控件使用

    //设置水平头
    ui->treeWidget->setHeaderLabels(QStringList()<<"角色"<<"角色介绍");

    QTreeWidgetItem *taoitem = new QTreeWidgetItem(QStringList()<<"逃生者");
    QTreeWidgetItem *zhuiitem = new QTreeWidgetItem(QStringList()<<"追捕者");

    //加载顶层的节点
    ui->treeWidget->addTopLevelItem(taoitem);
    ui->treeWidget->addTopLevelItem(zhuiitem);


    //添加逃生者子节点
    QStringList tao1,tao2,tao3;
    tao1 << "魔术师" << "道具戏法、移形换位、变羊术";
    tao2 << "小学妹" <<"抓不到我、哎呀好疼、来赛跑吗";
    tao3 << "失忆者" <<"来抓我呀、机关大师、购物达人";
    QTreeWidgetItem *t1 = new QTreeWidgetItem(tao1);
    QTreeWidgetItem *t2 = new QTreeWidgetItem(tao2);
    QTreeWidgetItem *t3 = new QTreeWidgetItem(tao3);
    taoitem->addChild(t1);
    taoitem->addChild(t2);
    taoitem->addChild(t3);


    //添加追捕者子节点
    QStringList zhui1,zhui2,zhui3;
    zhui1 << "机器人" << "声波探测、迷你雷达、自我强化";
    zhui2 << "雇佣兵" <<"会心一击、浑身是劲、再来一发";
    zhui3 << "女特工" <<"瞬移大师、自制陷阱、天降正义";
    QTreeWidgetItem *z1 = new QTreeWidgetItem(zhui1);
    QTreeWidgetItem *z2 = new QTreeWidgetItem(zhui2);
    QTreeWidgetItem *z3 = new QTreeWidgetItem(zhui3);
    zhuiitem->addChild(z1);
    zhuiitem->addChild(z2);
    zhuiitem->addChild(z3);
}

Widget::~Widget()
{
    delete ui;
}
